package com.yhsoft.common.Enum;

/**
 * @author yyyyyyyh
 * @since 2023-10-09
 */
public enum SexEnum {
    MAN(1, "男"),
    WOMAN(2, "女")
    ;

    private final int id;
    private final String name;

    SexEnum(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static SexEnum valueOf(Integer id) {
        if (id == null) {
            return null;
        }
        for (SexEnum value : SexEnum.values()) {
            if (value.id == id) {
                return value;
            }
        }
        return null;
    }
}
